package com.xuecheng.auth.feignClient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Author xiao
 * @Date 2024/12/23 下午 4:08
 * @ClassName: CheckCodeClientFallbackFactory
 * @Description: 熔断后降级
 */
@Component
@Slf4j
public class CheckCodeClientFallbackFactory implements FallbackFactory<CheckCodeClient> {
    @Override
    public CheckCodeClient create(Throwable throwable) {
        log.error("验证码校验发生了熔断降级,错误信息:{}",throwable.getMessage());
        return new CheckCodeClient() {
            @Override
            public Boolean verify(String key, String code) {
                return false;
            }
        };
    }
}
